﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace TowerDefence_Zombie
{
    [SerializeField]
    public class LevelPath : MonoBehaviour
    {
        [SerializeField]
        private Transform[] pathNodes;

        [SerializeField]
        public Color lineColor = Color.white;

        [SerializeField]
        public float pointSize = 0.1f;

        public Transform[] PathNodes
        {
            get
            {
                return pathNodes;
            }
        }

        private void OnDrawGizmos()
        {
            if (pathNodes == null || pathNodes.Length < 2) return;

            Gizmos.color = lineColor;

            foreach (var point in pathNodes)
            {
                if (point != null)
                {
                    Gizmos.DrawSphere(point.position, pointSize);
                }
            }

            for (int i = 0; i < pathNodes.Length - 1; i++)
            {
                if (pathNodes[i] != null && pathNodes[i + 1] != null)
                {
                    Gizmos.DrawLine(pathNodes[i].position, pathNodes[i + 1].position);
                }
            }
        }
    }

}